package com.lvs.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;
import java.net.UnknownHostException;

@RestController
public class Server1Controller {

	@RequestMapping(value = "/getHostName")
	public Object getObj() {
		String hostName = "";
		try {
			InetAddress localHost = InetAddress.getLocalHost();
			hostName =  localHost.getHostName();
		} catch (UnknownHostException e) {
			e.printStackTrace();
			hostName = "";
		}
		System.out.println("hostName:" + hostName);
		return hostName;
	}

}
